﻿using System.Collections.Generic;
using System.Xml;
using Common.Utilities.Excel.Xml;

namespace Common.Utilities.Excel.Import
{
    public class ExcelImportProvider
    {
        #region 构造方法
        public ExcelImportProvider(XmlNode section)
        {
            TypeName    = XmlUtility.getNodeAttributeStringValue(section, "typename");
            Worksheets  = GetWorksheets(section);
        }
        /// <summary>
        /// 获取所有的需要导入的工作薄信息
        /// </summary>
        /// <param name="section"></param>
        /// <returns></returns>
        private List<Worksheet> GetWorksheets(XmlNode section)
        {
            List<Worksheet> worksheets = new List<Worksheet>();
            XmlNodeList nodeList = section.ChildNodes;
            if (nodeList != null)
            {
                foreach (XmlNode node in nodeList)
                {
                    Worksheet workSheet = new Worksheet(node);
                    worksheets.Add(workSheet);
                }
            }
            return worksheets;
        }
        #endregion
        #region 属性定义
        private string _typeName;
        /// <summary>
        /// 类型
        /// </summary>
        public string TypeName
        {
            get { return _typeName; }
            set { _typeName = value; }
        }
        private List<Worksheet> _worksheets = null;
        /// <summary>
        /// 工作薄信息
        /// </summary>
        public List<Worksheet> Worksheets
        {
            get { return _worksheets; }
            set { _worksheets = value; }
        }
        #endregion

        

    }
}
